message functions - continued

XgrPeekMessage  (@wingrid, @message, @v0, @v1, @v2, @v3 )

XgrPeekMessage() returns the next message in the message queue in (wingrid,message,v0,v1,v2,v3) without removing it from the queue. If the message queue is empty, XgrPeekMessage() suspends the application until a message becomes available.

XgrProcessMessages  ( count )

XgrProcessMessages() executes the next count messages in the message queue. If there are no messages in the queue, XgrProcessMessages() suspends the program until a message is available, then processes them and returns. If one or more messages is in the queue, XgrProcessMessages() processes count messages or all pending messages, whichever occurs first, then returns.

count=0 tells XgrProcessMessages() to return immediately if no messages are in the message queue, otherwise process one message and return.

count=-1 tells XgrProcessMessages() to process all messages. If no messages are in the message queue, XgrProcessMessages() suspends the program until a messages becomes available, then processes it and returns. Otherwise XgrProcessMessages() processes all messages in the message queue, then returns.

count=-2 tells XgrProcessMessages() to process messages as they come in, suspending program execution whenever no messages are in the message queue, and returning only if and when it processes an ExitMessageLoop message.

First XgrProcessMessages() checks to see if a CEO function exists. If it does, it calls the CEO, passing it the message arguments, plus 0 in r0 and a copy of the window or grid argument in r1 . The CEO can return -1 in r0 to cancel the message. When XgrProcessMessages() detects the -1 in r0, it cancels the message and returns without calling any window function it would otherwise call.

Then XgrProcessMessages() checks to see if a window function exists for the window or grid argument in the message. If it does, it calls the function, passing it the message arguments plus 0 in r0 and a copy of the window or grid argument in r1 .